<%-- 
    Document   : courseGrade
    Created on : 2017-3-23, 23:07:11
    Author     : DELL
--%>
<%@page import="java.util.Iterator"%>
<%@page import="com.entity.StudentClasses"%>
<%@page import="com.entity.Classes"%>
<%@page import="java.util.ArrayList"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        
        
        
                       <%
        int sum =(Integer)session.getAttribute("sum");
         int pages =(Integer)session.getAttribute("pages");
           int curPage =(Integer)session.getAttribute("curPage");
    %> 
        
        
               <script type="text/javascript">
    
        function validate()
        {
            var page = document.getElementsByName("page")[0].value;
                
               
                
            if(page > <%=pages%>)
            {
                alert("你输入的页数大于最大页数，页面将跳转到首页！");
                
                window.document.location.href = "CourseGrade.action";
                
                return false;
            }
            
            return true;
        }
    
    </script>     
        
        

        
        
        
        
    </head>


    
    
    
    
    
    
    
    
    <body>



        <hr>
        <table width="100%" align="center">
            <tr >
                <td>
                    <s:a href="LookMessage.action">查看个人信息</s:a>
                    </td>
                    <td>
                    <s:a href="updateMessage.jsp">修改个人信息</s:a>
                    </td>
                    <td>
                    <s:a href="CourseGrade.action">课程成绩</s:a>
                    </td>
                    <td>
                    <s:a href="updatePassword.jsp">修改密码</s:a>
                    </td>
                    <td>
                    <s:a href="../index2.jsp" target="_top" >退出系统</s:a>
                    </td>

                </tr>
            </table>

            <hr>
            <br>
            <table  width="60%" align="center" border="2" cellspacing="0" cellpadding="0" bgcolor="gray">
                <tr align="center">
                    <th height="30">学号</th>
                    <th height="30">课程号</th>  
                    <th height="30">学分</th>
                    <th height="30">教室</th>
                    <th height="30">上课时间</th>
                    <th height="30">课程名</th>
                    <th height="30">成绩</th> 
                </tr>

            <%  List gradeList = null;
                gradeList = (List) session.getAttribute("gradeList");

                int l = gradeList.size();
                for (int i = 0; i < l; i++) {

                    Object[] tuple = (Object[]) gradeList.get(i);
                    Classes classes = (Classes) tuple[1];
                    StudentClasses sc = (StudentClasses) tuple[0];
            %>


            <tr>
                <td height="30" align="center"><%=sc.getTstId()%></td>
                <td height="30" align="center"><%=sc.getScsId()%></td>
                <td height="30" align="center"><%=classes.getCmark()%></td>
                <td height="30" align="center"><%=classes.getRoomId()%></td>
                <td height="30" align="center"><%=classes.getCourTime()%></td>
                <td height="30" align="center"><%=classes.getCname()%></td>   
                <td height="30" align="center"><%=sc.getCscore()%></td>  
            </tr> 
            <%                }
            %>


        </table>
            
            
<!--            <hr>
            <div>
                
                <table  width="60%" align="center" border="0" cellspacing="0" cellpadding="0"  bgcolor="#ffffff">
                    <tr align="center">
                        
                        <td height="30" align="center">
                            第<%=curPage%>页 &nbsp;&nbsp;&nbsp; 共<%=pages%>页 &nbsp;&nbsp;&nbsp; 共<%=sum%>条记录
                        </td>
                    </tr>
                </table>
                        
            </div>
            <hr>-->
            
           <center>
       <font size="5">第<font color="red"><%=curPage%></font>页 </font>&nbsp;&nbsp;
        <font size="5">共<font color="red"><%=pages%></font>页 </font>&nbsp;&nbsp;
        <font size="5">共<font color="red"><%=sum%></font>条记录</font><br><br>
        
      
            
            <%
                    if(curPage ==1){  
            
            %>
            
            首页&nbsp;&nbsp;&nbsp;上一页
            
                 <%
                   } else{  
            


//                   String   currpage=;
            %>       
            
            
   
            <a href="CourseGrade.action">首页</a>
            &nbsp;&nbsp;&nbsp;
            <a href="CourseGrade.action?page=<%=(curPage-1)%>">上一页</a>
    
        
                        <%
                   }   
            
            %>  
        
        
                        <%
                    if(curPage!= pages){  
            
                  
            %>
            

            
            <a href="CourseGrade.action?page=<%=(curPage+1)%>">下一页</a>
            &nbsp;&nbsp;&nbsp;
<!--            <a href="CourseGrade!lastQuery.action"/>尾页</a>-->
            
             <a href="CourseGrade.action?page=<%=pages%>">尾页</a>
                 <%
                   } else{  
            
            %>       
            
            
   
           下一页&nbsp;&nbsp;&nbsp;尾页
    
        
                        <%
                   }   
            
            %>  
            
       
    
    </center><br>
    
    <center>
        
        <form action="CourseGrade.action" onsubmit="return validate();">
            <font size="4">跳转至第</font>
            <input type="text" size="4" name="page">页
            <input type="submit" value="跳转">
        </form>
        
    </center>
            
            
            
            

    </body>
</html>
